package br.com.social.mobile.daemon;

import org.apache.log4j.Logger;

import br.com.social.mobile.dao.ParameterDAO;
import br.com.social.mobile.entities.Parameter;

public class BDKeepAlive {
	 
    String message;
    private Logger logger = Logger.getLogger(BDKeepAlive.class);
 
    public BDKeepAlive(String message){
        this.message = message;
    }
 
    public void invokeIndefinitePrintTask(){
        while(true){

            try {
            	logger.info("Executando Daemon");
            	ParameterDAO dao = new ParameterDAO();
            	Parameter parameter = dao.getById(1l);
            	
            	logger.info("parameter.getDsParamName()" + parameter.getDsParamName());            	
                Thread.sleep(1000*15);
            } catch (InterruptedException e) {
            	logger.info("Caught an exception while sleeping. Description: " + e.getMessage());
            } catch (Exception e) {
            	logger.info("Caught an exception while sleeping. Description: " + e.getMessage());
            }
        }
    }
 
}